package org.example.entity;

import lombok.Data;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;

/**
 * @Description:
 */
@Data
@Document(indexName = "contents_index", createIndex = false)
public class ContentsIndex implements Serializable {

    private static final long serialVersionUID = 1L;
    public static final String KEY_ID = "id";
    public static final String KEY_TITLE = "title";
    public static final String KEY_INTRO = "intro";
    public static final String KEY_CONTENT = "content";
    public static final String KEY_CREATE_ID = "createId";
    public static final String KEY_CREATE_NAME = "createName";
    public static final String KEY_CREATE_TIME = "createTime";

    @Field(type = FieldType.Integer)
    private Integer id;

    @Field(type = FieldType.Keyword)
    private String title;

    @Field(type = FieldType.Keyword)
    private String intro;

    @Field(type = FieldType.Text)
    private String content;

    @Field(type = FieldType.Integer)
    private Integer createId;

    @Field(type = FieldType.Keyword)
    private String createName;

    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
    private Date createTime;
}

